import { createRouter, createWebHashHistory} from "vue-router";
let routesList = [
    {name: 'homePage'}
]

let routes = [
    {
        path: '/',
        redirect: '/homePage'
    },
]
routesList.forEach(e => {
    routes.push({
        path: '/' + e.name,
        name: e.name,
        meta: {
            title: e.name,
        },
        component: () => import('/src/views/' + e.name + '/index.vue')
    })
})


const router = createRouter({
    history: createWebHashHistory(),
    routes
})

router.beforeEach((to,from,next) => {
    document.title = to.meta.title
    next()
})

export default router
